<template>
  <div>
    <el-form
      ref="form"
      :model="form"
      :rules="rules"
      label-width="100px"
      label-position="left"
    >
      <!-- <el-form-item label="分类名称" prop="class">
        <el-select
          clearable
          v-model="form.class"
          placeholder="请选择分类名称"
          style="width: 100%"
        >
          <el-option
            v-for="(item, index) in classList"
            :key="index"
            :value="item.value"
            >{{ item.label }}</el-option
          >
        </el-select>
      </el-form-item>
       -->
      <el-form-item label="平台" prop="platform">
        <el-input readonly
          v-model="form.platform"
          placeholder=""
          maxlength="50"
        />
      </el-form-item>
      <el-form-item label="活动ID" prop="desc">
        <el-input readonly
          v-model="form.desc"
          placeholder=""
        />
      </el-form-item>
      <el-form-item label="昵称" prop="desc">
        <el-input readonly
          v-model="form.desc"
          placeholder=""
        />
      </el-form-item>
      <el-form-item label="昵称" prop="desc">
        <el-input readonly
          v-model="form.desc"
          placeholder=""
        />
      </el-form-item>
      <el-form-item label="投诉类型" prop="desc">
        <el-input readonly
          v-model="form.desc"
          placeholder=""
        />
      </el-form-item>
      <!-- <el-form-item label="模板分类" prop="template">
        <el-select
          clearable
          v-model="form.template"
          placeholder="请选择模板分类"
          style="width: 100%"
        >
          <el-option
            v-for="(item, index) in tempList"
            :key="index"
            :value="item.value"
            >{{ item.label }}</el-option
          >
        </el-select>
      </el-form-item> -->
      <el-form-item label="投诉内容" prop="code">
        <el-input readonly
          v-model="form.code"
          placeholder=""
          type="textarea"
          rows="3"
        />
      </el-form-item>
      <el-form-item label="备注" prop="desc">
        <el-input
          v-model="form.desc"
          placeholder=""
          type="textarea"
          rows="3"
        />
      </el-form-item>
      <!-- <el-form-item label="状态" prop="status">
        <el-radio-group v-model="form.status">
          <el-radio :label="1">正常</el-radio>
          <el-radio :label="2">禁用</el-radio>
        </el-radio-group>
      </el-form-item> -->
    </el-form>
    <div class="flexend">
      <el-button type="primary" @click="submitForm">确 定</el-button>
      <el-button @click="handleCloseAdd()">取 消</el-button>
    </div>
  </div>
</template>

<script>
import { isOverSize } from "@/utils/validate";
import { uploadPhoto } from "@/api/comm";
export default {
  data() {
    return {
      form: {},
      classList: [{ label: "抽奖专用模板", value: 1 }],
      tempList: [{ label: "抽奖活动", value: 1 }],
      // 表单校验
      rules: {
        // class: [
        //   { required: true, message: "分类名称不能为空", trigger: "blur" },
        // ],
        // imgurl: [
        //   { required: true, message: "预览图不能为空", trigger: "blur" },
        // ],
        // name: [
        //   { required: true, message: "模板名称不能为空", trigger: "blur" },
        // ],
        // template: [
        //   { required: true, message: "模板分类不能为空", trigger: "blur" },
        // ],
        // status: [{ required: true, message: "状态不能为空", trigger: "blur" }],
      },
    };
  },
  methods: {
    reset() {
      this.form = {
        id: undefined,
        class: undefined,
        name: undefined,
        imgurl: undefined,
        template: undefined,
        status: 1,
        menuIds: [],
      };
      this.resetForm("form");
    },

    handleCloseAdd(type) {
      this.$emit("close", type);
    },

    /** 提交按钮 */
    submitForm: function () {
      this.$refs["form"].validate((valid) => {
        if (valid) {
          if (this.form.roleId != undefined) {
            this.form.menuIds = this.getMenuAllCheckedKeys();
            updateRole(this.form).then((response) => {
              this.$modal.msgSuccess("修改成功");
              this.open = false;
              this.getList();
            });
          } else {
            this.form.menuIds = this.getMenuAllCheckedKeys();
            addRole(this.form).then((response) => {
              this.$modal.msgSuccess("新增成功");
              this.open = false;
              this.getList();
            });
          }
        }
      });
    },
  },
};
</script>
<style lang="scss" scoped>
.inputbox {
  position: relative;
  padding: 0 20px;
  cursor: pointer;
}
.uploadinput {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  opacity: 0;
  cursor: pointer;
}
.imginput {
  ::v-deep .el-input-group__append {
    padding: 0 !important;
  }
}
.imgurl {
  width: 200px;
  height: 80px;
}
</style>